# encoding:utf-8

import requests
import base64
import os

headers = {'content-type': 'application/json'}
request_url = "http://localhost:19951/captcha/v1"

path = r"C:\\Users\\WJG\\Desktop\\新建文件夹"

path_list = os.listdir(path)
for p in path_list:
  temp=path+"\\"+p
  f = open(temp, 'rb')
  img = base64.b64encode(f.read()).decode()
  params = {"image":img}
  response = requests.post(request_url, json=params, headers=headers)
  if response:
      print (p+"-->"+response.json()['message'])